#ifndef _LORA_SPI_H_
#define _LORA_SPI_H_

#include <stdint.h>

#define LORA_SPI_TIMEOUT_CNT        ( (uint32_t)0x1000 )

#define LORA_SPIx                   SPI1
#define LORA_SPI_APBxClock_FUN      RCC_APB2PeriphClockCmd
#define LORA_SPI_CLK                RCC_APB2Periph_SPI1

// NSS引脚 片选选普通GPIO即可
#define LORA_SPI_NSS_APBxClock_FUN  RCC_APB2PeriphClockCmd
#define LORA_SPI_NSS_CLK            RCC_APB2Periph_GPIOB   
#define LORA_SPI_NSS_PORT           GPIOB
#define LORA_SPI_NSS_PIN            GPIO_Pin_0

// SCK引脚
#define LORA_SPI_SCK_APBxClock_FUN  RCC_APB2PeriphClockCmd
#define LORA_SPI_SCK_CLK            RCC_APB2Periph_GPIOA   
#define LORA_SPI_SCK_PORT           GPIOA   
#define LORA_SPI_SCK_PIN            GPIO_Pin_5

// MISO引脚
#define LORA_SPI_MISO_APBxClock_FUN RCC_APB2PeriphClockCmd
#define LORA_SPI_MISO_CLK           RCC_APB2Periph_GPIOA    
#define LORA_SPI_MISO_PORT          GPIOA 
#define LORA_SPI_MISO_PIN           GPIO_Pin_6

// MOSI引脚
#define LORA_SPI_MOSI_APBxClock_FUN RCC_APB2PeriphClockCmd
#define LORA_SPI_MOSI_CLK           RCC_APB2Periph_GPIOA    
#define LORA_SPI_MOSI_PORT          GPIOA 
#define LORA_SPI_MOSI_PIN           GPIO_Pin_7

// DIO0引脚
#define LORA_DIO0_APBxClock_FUN     RCC_APB2PeriphClockCmd
#define LORA_DIO0_CLK               RCC_APB2Periph_GPIOB    
#define LORA_DIO0_PORT              GPIOB 
#define LORA_DIO0_PIN               GPIO_Pin_2

// RESET引脚
#define LORA_RST_APBxClock_FUN      RCC_APB2PeriphClockCmd
#define LORA_RST_CLK                RCC_APB2Periph_GPIOB    
#define LORA_RST_PORT               GPIOB 
#define LORA_RST_PIN                GPIO_Pin_1


void lora_spi_init(void);
uint8_t lora_spi_send_char(uint8_t byte);

#endif  /* lora_spi.h */

